<?Lassoscript
// Last modified 8/5/11 by ECL, Landmann InterActive

// FUNCTIONALITY
// Used to edit an individual record

// CHANGE NOTES
// 11/23/07
// Recoded for CMS v. 3.0
// 11/29/07
// Moving login check to kill session before navbar is displayed
// 4/30/08
// Added LI_CMSatend at bottom of page to set focus to login box
// 5/20/08
// Recoded URL Links
// 1/15/09
// Added new datatype "Story"
// 6/19/09
// Adding new datatype "Gallery"
// 7/23/09
// Added Robot Check
// 8/5/11
// Added new datatype "Slider"

// Robot check
Include(($svBaseHelpersPath)+'robotcheck.inc');

// Start the Admin session
Session_Start(-Name=$svSessionAdminName, -Expires=$svSessionTimeout);

// Include the Page Intercept
Include(($svAdminHelpersPath)+'page_intercept.inc');

// Convert action_params
Var('vDataType' = Action_Param('DataType'));

// Page head
Include(($svAdminHelpersPath)+'page_header_admin.inc');

// Determine which container to output
Var('OutputOpenContainer' = string);
Var('OutputCloseContainer' = string);
If($vDataType == 'User');
	$OutputOpenContainer = '\t\t\t<div class="contentcontainerwhite600">\n';
	$OutputCloseContainer = '\t\t\t</div>\n';
Else(($vDataType == 'PortfolioEntry') || ($vDataType == 'PortfolioGroup') ||
	($vDataType == 'SliderEntry') || ($vDataType == 'SliderGroup') ||
	($vDataType == 'Content') || ($vDataType == 'Testimonial') || ($vDataType == 'Story'));
	// Output nothing
/If;

// Debugging
// Var('svDebug' = 'Y');
?>
<table width="780">
	<tr>
		<td width="170">
[Include(($svAdminHelpersPath)+'navbar_main.inc')]
		</td>
		<td>
<?Lassoscript
// Output the opening container
$OutputOpenContainer;

// Login check
If(Var('svUser_ID') != '');

	If($vDataType == 'Content');
		Include(($svAdminViewsPath)+'frm_content.inc');
		Include(($svAdminHelpersPath)+'show_content.inc');
	Else($vDataType == 'Testimonial');
		Include(($svAdminViewsPath)+'frm_testimonial.inc');
		Include(($svAdminHelpersPath)+'show_testimonials.inc');
	Else($vDataType == 'Story');
		Include(($svAdminViewsPath)+'frm_story.inc');
		Include(($svAdminHelpersPath)+'show_stories.inc');
	Else($vDataType == 'PortfolioGroup');
		Include(($svAdminViewsPath)+'frm_portfoliogroups.inc');
		Include(($svAdminHelpersPath)+'show_portfoliogroups.inc');
		Include(($svAdminHelpersPath)+'show_portfolioentries.inc');
	Else($vDataType == 'PortfolioEntry');
		Include(($svAdminViewsPath)+'frm_portfolioentry.inc');
		Include(($svAdminHelpersPath)+'show_portfolioentries.inc');
	Else($vDataType == 'GalleryGroup');
		Include(($svAdminViewsPath)+'frm_gallerygroup.inc');
		Include(($svAdminHelpersPath)+'show_gallerygroups.inc');
		Include(($svAdminHelpersPath)+'show_galleryentries.inc');
	Else($vDataType == 'GalleryEntry');
		Include(($svAdminViewsPath)+'frm_galleryentry.inc');
		Include(($svAdminHelpersPath)+'show_galleryentries.inc');
	Else($vDataType == 'SliderGroup');
		Include(($svAdminViewsPath)+'frm_slidergroup.inc');
		Include(($svAdminHelpersPath)+'show_slidergroups.inc');
		Include(($svAdminHelpersPath)+'show_sliderentries.inc');
	Else($vDataType == 'SliderEntry');
		Include(($svAdminViewsPath)+'frm_sliderentry.inc');
		Include(($svAdminHelpersPath)+'show_sliderentries.inc');
	Else(($vDataType == 'User') || ($vDataType == 'UserPhoto'));
		Include(($svAdminViewsPath)+'frm_user.inc');
		Include(($svAdminHelpersPath)+'show_users.inc');

	// If wrong parameter passed, end the session, set error to 6004 "Access Restricted" redirect to login
	Else;

		// Session_End(-Name=$svSessionAdminName);
		Var('svUser_ID' = '');
		Var('svUserLoginID' = '');
		Var('svUserPrivs_Priv' = '');

		Var('vError' = '6004');
		LI_URLRedirect(-Page=$svLoginPage,-UseError='Y',-Error=$vError);
	/If;

Else;

	// Set error to 6003 "Session Expired", redirect to login
	Var('vError' = '6003');
	LI_URLRedirect(-Page=$svLoginPage,-UseError='Y',-Error=$vError);

/If;

// Output the closing container
$OutputCloseContainer;

?>		</td>
	</tr>
</table>
[Include(($svBaseHelpersPath)+'build_footer.inc')]
[OutputFooter]
</body>
[LI_CMSatend]
</html>
